package com.jzo2o.health.model.dto.request;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDate;

@Data
@ApiModel("下单请求信息")
public class PlaceOrderReqDTO {
    @ApiModelProperty(value = "套餐id", required = true)
    @NotNull(message = "套餐id不能为空")
    private Integer setmealId;

    @ApiModelProperty(value = "预约日期", required = true)
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @NotNull(message = "预约日期不能为空")
    private LocalDate reservationDate;

    @ApiModelProperty(value = "体检人姓名", required = true)
    @NotBlank(message = "姓名不能为空")
    @Pattern(regexp = "^[\u4e00-\u9fa5a-zA-Z]{2,10}$", message = "姓名必须为2-10位汉字或字母")
    private String checkupPersonName;

    @ApiModelProperty(value = "体检人性别，0：不限，1：男，2女", required = true)
    @NotNull(message = "性别不能为空")
    private Integer checkupPersonSex;

    @ApiModelProperty(value = "体检人电话", required = true)
    @NotBlank(message = "体检人电话不能为空")
    @Pattern(regexp = "^[1][3-9]\\d{9}$", message = "体检人电话非法")
    @Pattern(regexp = "^\\d{11}$", message = "体检人电话必须是11位")
    private String checkupPersonPhone;

    @ApiModelProperty(value = "体检人身份证号", required = true)
    @NotBlank(message = "身份证不能为空")
    @Pattern(regexp = "^\\d{17}[\\dX]$", message = "身份证号非法")
    private String checkupPersonIdcard;
}
